package main

import (
	"fmt"
	"reflect"
)

type NotknownType struct {
	s1, s2, s3 string
}

func (n NotknownType) String() string {
	return fmt.Sprintf("%s - %s - %s", n.s1, n.s2, n.s3)
}

var secret interface{} = NotknownType{"Google", "Baidu", "Twitter"}

func main() {
	value := reflect.ValueOf(secret)
	typ := reflect.TypeOf(secret)
	fmt.Println(value)                   // Google - Baidu - Twitter
	fmt.Println("type of secret: ", typ) // main.NotknownType
	knd := value.Kind()
	fmt.Println("kind of value: ", knd) // struct

	for i := 0; i < value.NumField(); i++ {
		fmt.Printf("Field %d: %v\n", i, value.Field(i))
	}
	res := value.Method(0).Call(nil)
	fmt.Println(res) // [Google - Baidu - Twitter]
}
